package com.qifenqian.turbot.module.adapter.restaurant

import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.qifenqian.turbot.R
import com.qifenqian.turbot.module.entity.response.dish.DishEntity
import kotlinx.android.synthetic.main.item_dish.view.*

/**
 * @author H
 * @createTime 2018/12/21 17:52
 * @description
 * @see
 * @since
 */
class DishManageRvAdapter(layoutResId: Int, dishEntities: MutableList<DishEntity>) : BaseQuickAdapter<DishEntity, BaseViewHolder>(layoutResId, dishEntities) {

    override fun convert(helper: BaseViewHolder, item: DishEntity) {
        val view = helper.itemView
        view.tv_item_dish_name.text = item.dishName
        view.tv_item_dish_price.text = "${item.price / 100}"
        val options = RequestOptions().error(R.mipmap.ic_launcher)
        Glide.with(mContext).load(item.dishPhotoPath).apply(options).into(view.iv_item_dish_image)
    }
}